
// GRaphAppDlg.h : header file
//

#pragma once

#include <vector>

using std::vector;

#include "Nod.h"
#include "Constants.h"

using namespace Constants;

// CGRaphAppDlg dialog
class CGRaphAppDlg : public CDialogEx
{
// Construction
public:
	CGRaphAppDlg(CWnd* pParent = NULL);	// standard constructor
	~CGRaphAppDlg();

// Dialog Data
	enum { IDD = IDD_GRAPHAPP_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	
	Figure* GetSelectedFigure(const UINT nFlags,const CPoint& point);

	void UpdateSelectedFigure(const CPoint& point);

    bool CheckNodeCollision(const Figure* figure, const CRect& checkFigure);
 

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnDrawNod();
	afx_msg void OnDrawLine();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	DECLARE_MESSAGE_MAP()

private:
	EDrawState		_drawState;
	vector<Figure*>	_figures;
	Figure*			_selectedFigure;
	int				_updateState;
    CPoint          _figureSelectedPoint;
public:
	CString m_strCoord;
};
